MCQ Answer

What will be the output of the following Python list comprehension?

[j for i in range(2,8) for j in range(i*2, 50, i)]

What will be the output of the following Python list comprehension?

[j for i in range(2,8) for j in range(i*2, 50, i)]


निम्नलिखित पायथन लिस्ट काम्प्रीहेन्शन का ऑउटपुट क्या होगा?
Topic : Sequence data types in python

A. A list of prime numbers up to 50 50 तक प्राइम नंबर्स की लिस्ट

B. A list of numbers divisible by 2, up to 50 2 से डिविजिबल नंबर्स की एक लिस्ट, 50 तक

C. A list of non prime numbers, up to 50 नॉन प्राइम नंबर्स की लिस्ट, 50 तक

D. Error एरर




Correct Answer is :

C. A list of non prime numbers, up to 50



Explanation
The list comprehension shown above returns a list of non-prime numbers up to 50. The logic behind this is that the square root of 50 is almost equal to 7. Hence all the multiples of 2-7 are not prime in this range.
CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz